/** 
 * Project Name:carteam-core 
 * File Name:IsDeleteType.java 
 * Package Name:tf56.kangaroo.carteam 
 * Date:2019年1月8日上午10:55:58 
 * Copyright (c) 2019, 21637@etransfar.com All Rights Reserved. 
 * 
 */
package com.acaomei.skype.common;

import org.apache.commons.lang3.StringUtils;

/**
 * 描述: 响应枚举
 * @ClassName: ResponseEnum
 * @author wudd
 * @date 2019年7月15日 下午2:07:41  
 * @version v1.0
 */
public enum ResponseEnum {
	add_error("801", "添加失败"), 
	update_error("802", "修改失败"), 
	remove_error("803", "删除失败"),
	query_error("804","查询失败");
	
	private String code;
	
	private String detail;
	
	private ResponseEnum(String code, String detail) {  
        this.code = code;  
        this.detail = detail;  
    }
	
	
	/**
	 * 描述：判断是否为是正确的数据
	 * @param code
	 * @return boolean
	 */
	public static boolean isAddError(String code) {  
		ResponseEnum enumType = getEnumType(code);
		if(enumType == null) {
			return false; 
		}
		switch(enumType){
			case add_error : 
				return true; 
			default: 
				return false; 
		}
    }
	
	/**
	 * 描述：根据code，获取枚举类型
	 * @Title: getName   
	 * @param code
	 * @return String
	 * @throws
	 */
	public static ResponseEnum getEnumType(String code) {  
        for (ResponseEnum enumType : ResponseEnum.values()) {  
            if (StringUtils.equals(enumType.getCode(), code)) {  
                return enumType;  
            }  
        }  
        return null;  
    } 
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	} 
	
}

	